import request from '../../../../../public/js/common/api/api.js';

const SysAuthUrl = `${Utils.CurDomain.SysAuthUrl}`;
const configuration = {
    contentType: 'application/json',
    dataType: 'json',
    async: true,
    dataFilter(data, type) {
        return data;
    }
}

export default class SwitchOrgAPI {
    // 用户拥有组织
    static queryUserOrg(id) {
        return request.get(`${SysAuthUrl}/yfuser/orgs`, "", true,);
    }
    // 获取公司和部门
    static queryComDepList(upoid, aotype) {
        return request.get(`${SysAuthUrl}/baseorgunit/q?upoid=${upoid}&aotype=${aotype}`, "", true,);
    }
    //切换组织
    static switchOrg(data) {
        return request.post(`${SysAuthUrl}/account/switchorg`, data, true, configuration);
    }
    // 用户默认组织
    static queryUserName() {
        return request.get(`${SysAuthUrl}/account/u`);
    }
}